﻿/// <reference path="../Turbo/Turbo.js" />


var $TextImageRelation = TA.Turbo.Common.TextImageRelation =
{
	Overlay: 0,
	ImageBeforeText: 1,
	TextBeforeImage: 2,
	ImageAboveText: 3,
	TextAboveImage: 4
};


TA.Turbo.Controls.PagerElement = function PagerElement()
{
}
TA.Turbo.Controls.PagerElement.Inherit(BaseJsonSerializable);
TA.Turbo.Controls.PagerElement.Inherit(BaseJsonDeserializable);
if (____a)
	TA.Turbo.Controls.PagerElement.prototype = new BaseJsonDeserializable();
$PagerElement = TA.Turbo.Controls.PagerElement;

$PagerElement.prototype.CssClass = "";
$PagerElement.prototype.Style = "";
$PagerElement.prototype.ImageSrc = "";
$PagerElement.prototype.Text = "";
$PagerElement.prototype.DefaultText = "";
$PagerElement.prototype.Href = "";
$PagerElement.prototype.HrefJS = "";
$PagerElement.prototype.TextImageRelation = $TextImageRelation.ImageBeforeText;
$PagerElement.prototype.Visible = true;

$PagerElement.prototype.SerializeContents = function SerializeContents(jw)
{
	if (____a)
		jw = new JsonWriter();

	if (!String.IsNullOrEmpty(this.CssClass))
		jw.Property("C", this.CssClass);

	if (!String.IsNullOrEmpty(this.Style))
		jw.Property("S", this.Style);

	if (!String.IsNullOrEmpty(this.Href))
		jw.Property("H", this.Href);

	if (!String.IsNullOrEmpty(this.HrefJS))
		jw.Property("HJ", this.HrefJS);

	if (!String.IsNullOrEmpty(this.ImageSrc))
		jw.Property("I", this.ImageSrc);

	if (this.Text != this.DefaultText)
		jw.Property("T", this.Text);

	if (this.TextImageRelation != $TextImageRelation.ImageBeforeText)
		jw.Property("R", this.TextImageRelation);

	if (!this.Visible)
		jw.Property("V", this.Visible);
}
$PagerElement.prototype.get_IsDirty = function get_IsDirty()
{
	return !String.IsNullOrEmpty(this.CssClass)
		|| !String.IsNullOrEmpty(this.Style)
		|| !String.IsNullOrEmpty(this.ImageSrc)
		|| !String.IsNullOrEmpty(this.Text)
		|| this.TextImageRelation != $TextImageRelation.ImageBeforeText
		|| !this.Visible;
}
$PagerElement.prototype.DeserializeContent = function DeserializeContent(prShortName, value)
{
	switch (prShortName)
	{
		case "C":
			this.CssClass = value; break;
		case "S":
			this.Style = value; break;
		case "I":
			this.ImageSrc = value; break;
		case "T":
			this.Text = value; break;
		case "R":
			this.TextImageRelation = "R"; break;
		case "V":
			this.Visible = value; break;
		case "H":
			this.Href = value; break;
		case "HJ":
			this.HrefJS = value; break;
	}
}


